package com.sfc.sdsr.server.dao;

import java.util.List;

import org.apache.log4j.Logger;

import com.sfc.sdsr.common.model.Address;
import com.sfc.sdsr.common.model.Event;
import com.sfc.sdsr.common.model.News;
import com.sfc.sdsr.common.model.Person;
import com.sfc.sdsr.common.model.Song;

public class BrokenDao implements Dao {

	private Logger log = Logger.getLogger(getClass());
	private static BrokenDao instance;
	private String message = "";
	
	private BrokenDao(String message) {
		this.message = message;
		log.error(this.message);
	}
	
	public synchronized static BrokenDao getInstance(String message) {
		if (instance == null) {
			instance = new BrokenDao(message);
		}
		instance.message = message;
		return instance;
	}
	
	@Override
	public boolean createEvent(Event event) {
		throw new BrokenServerException(message);
	}

	@Override
	public boolean createMember(Person person) {
		throw new BrokenServerException(message);
	}

	@Override
	public List<Event> getEvents() {
		throw new BrokenServerException(message);
	}

	@Override
	public List<Person> getMembers() {
		throw new BrokenServerException(message);
	}

	@Override
	public boolean createNews(News news) {
		throw new BrokenServerException(message);
	}

	@Override
	public boolean createSong(Song song) {
		throw new BrokenServerException(message);
	}

	@Override
	public List<News> getNews() {
		throw new BrokenServerException(message);
	}

	@Override
	public List<Song> getSongs() {
		throw new BrokenServerException(message);
	}

    @Override
    public boolean createAddress(Address address) {
        throw new UnsupportedOperationException();
    }

    @Override
    public List<Address> getAddresses() {
        throw new UnsupportedOperationException();
    }

}
